<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>设计调查</title>
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/styles.css">
	</head>
	<body>
<div class="divWhiteLine"></div>
		<table>
				<tbody><tr>
					<td colspan="2" class="tdWhiteLine"></td>
				</tr>
				<tr>
					<td colspan="2" class="tdHeader">设计调查</td>
				</tr>
				<tr>
					<td colspan="2" class="tdWhiteLine"></td>
				</tr>
				<tr>
					<td class="tdSHeaderL">
						${survey.title }
					</td>
					<td class="tdSHeaderR">
						<a href="${pageContext.request.contextPath}/addPage.jsp?id=${survey.id}">增加页</a>&nbsp;
					</td>
				</tr>
				<tr>
					<td colspan="2" style="text-align: left;vertical-align: top;">
						<table >
							<tbody><tr>
								<td width="30px"></td>
								<td width="*">
									<table>
										<tbody>
										<c:forEach items="${survey.pageList}" var="page">
										<tr>
											<td>
												<table>
													<tbody><tr>
														<!-- 页面标题 -->
														<td class="tdPHeaderL">${page.title }</td>
														<td class="tdPHeaderR">
															<a href="${pageContext.request.contextPath}/questionType.jsp?sid=${survey.id}&pid=${page.id}">增加问题</a>&nbsp;
														</td>
													</tr>
												</tbody></table>
											</td>
										</tr>
										<tr>
											<td>
												<table>
													<tbody><tr>
														<td width="30px"></td>
														<td width="*">
															<table>
																<tbody>
																<c:forEach items="${page.questionList}" var="question">
																<tr>
																	<td>
																		<table>
																			<!-- 迭代问题集合 -->
																			<tbody><tr>
																				<!-- 问题题干 -->
																				<td class="tdQHeaderL">${question.title}</td>
																				<td class="tdQHeaderR">
																					<a href="#">删除问题</a>&nbsp;
																				</td>
																			</tr>
																			<tr>
																				<td colspan="2" style="text-align: left;color: black;background-color: white">
																					<!-- 定义变量,设置第一大类的题型 -->
																					<c:if test="${question.questiontype lt 4 }">
																					<!-- 判断当前题型是否属于第一大类(0,1,2,3) -->
																							<c:forEach items="${question.optionArr}" var="option">																						
																							<input type="${question.questiontype< 2?'radio':'checkbox' }">${option }
																							<c:if test="${question.questiontype == 1 || question.questiontype == 3 }"><br></c:if>
																							</c:forEach>
																						
																						<!-- 处理other问题 -->
																						<c:if test="${question.other==1}">
																							<input type="${question.questiontype< 2?'radio':'checkbox' }">其他
																							<!-- 文本框 -->
																							<c:if test="${question.otherstyle == 1}">
																								<input type="text">
																							</c:if>
																							<!--  下拉列表 -->
																							<c:if test="${question.otherstyle == 2}">
																								<select>
																									<c:forEach items="${question.otherSelectOptionArr}" var="otheroption">
																										<option>${otheroption }</option>
																									</c:forEach>
																								</select>
																							</c:if>
																						</c:if>
																					</c:if>
																					<c:if test="${question.questiontype==4 }">
																						<select>
																							<c:forEach items="${question.optionArr}" var="option">
																								<option>${option }</option>
																							</c:forEach>
																						</select>
																					</c:if>
																					<c:if test="${question.questiontype==5 }">
																						<input type="text">
																					</c:if>
																					<c:if test="${question.questiontype>5 }">
																						<table>
																							<!-- 列头 -->
																							<tr>
																								<td></td>
																								<c:forEach items="${question.matrixColTitleArr}" var="col">
																									<td>${col }</td>
																								</c:forEach>
																							</tr>
																							<!-- 输出n多行 -->
																							<c:forEach items="${question.matrixRowTitleArr}" var="row">
																								<tr>
																									<td>${row }</td>
																									<!-- 套打控件 -->
																									<c:forEach items="${question.matrixColTitleArr}">
																										<td>
																											<!-- radio -->
																											<c:if test="${question.questiontype == 6}"><input type="radio"></c:if>
																											<c:if test="${question.questiontype == 7}"><input type="checkbox"></c:if>
																											<c:if test="${question.questiontype == 8}">
																												<select>
																													<c:forEach items="${question.matrixSelectOptionArr}" var="so">
																														<option>${so}</option>
																													</c:forEach>
																												</select>
																											</c:if>
																										</td>
																									</c:forEach>
																								</tr>
																							</c:forEach>
																						</table>
																					</c:if>
																				</td>
																			</tr>
																		</tbody></table>
																	</td>
																</tr>
																</c:forEach>
															</tbody></table>
														</td>
													</tr>
												</tbody></table>
											</td>
										</tr>
										</c:forEach>
									</tbody></table>
								</td>
							</tr>
						</tbody></table>
					</td>
				</tr>
			</tbody></table>
	
</body></html>